<?php

namespace App\Http\Controllers\Managea;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repositories\DeliveryRepository;
use App\Traits\BaseFun;

class DeliveryController extends Controller
{
	public function __construct(DeliveryRepository $DeliveryRepository)
    {
        $this->DeliveryRepository=$DeliveryRepository;
    }
    public function DeliveryInfo(Request $request)
    {
        $res=$this->DeliveryRepository->info(['id'=>1]);
        if ($res) {
           $ArrDate = ['state' => 0, 'data' => $res, 'token' => $request->input('token')];
        }else{
           $ArrDate = ['state' => 2, 'data' => $res, 'msg' => '获取失败!']; 
        }
        return BaseFun::jsonReturn($ArrDate);
    }
    public function DeliveryUpdate(Request $request)
    {
        $res=$this->DeliveryRepository->update($request->all());
        if ($res) {
           $ArrDate = ['state' => 0, 'data' => $res, 'token' => $request->input('token')];
        }else{
           $ArrDate = ['state' => 2, 'data' => $res, 'msg' => '修改成功!']; 
        }
        return BaseFun::jsonReturn($ArrDate);
    }

}
